﻿

namespace Mulala.Cavan.Presentation.Mvc.Controller
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Mulala.Cavan.Presentation.Seedwork;
    using Mulala.Cavan.Domain.MainBoundedContext.NannyModule;
    using Mulala.Cavan.Domain.MainBoundedContext.SearchModule;
    using Mulala.Cavan.Presentation.Mvc.ViewModel;
    using Mulala.Cavan.Application.MainBoundedContext.NannyModule;
    using System.Web.Mvc;
    using Mulala.Cavan.Domain.MainBoundedContext.Setting;

    public class NannyDiaryController : EntityController<NannyDiary, NannyDiarySearch, INannyDiaryViewModel, INannyDiaryAppService>, INannyDiaryController
    {
        public override string ControllerName
        {
            get { return "NannyDiary"; }
        }

        public override bool UseDenied
        {
            get { return false; }
        }

        [ActionName("diary")]
        public ActionResult GetDiaries(int id, int cp)
        {
            IDictionary<string, bool> orderBy = new Dictionary<string, bool>();
            orderBy.Add("CreateTime", true);

            NannyDiarySearch nannyDiarySearch = NannyDiarySearchFactory.CreateNannyDiarySearch(id, orderBy, cp, Project.Settings.MaxRowsPerPage);

            long total = 0;
            IList<NannyDiary> nannyDiaries = this.AppService.GetBySearch(nannyDiarySearch, out total).ToList();

            return View(nannyDiaries);
        }
    }
}
